package com.gitee.wsl.struct.grammar.ext

import com.gitee.wsl.struct.grammar.GrammarContext
import com.gitee.wsl.struct.grammar.parser.Parser
import com.gitee.wsl.struct.grammar.parser.combinator.separated


fun <T : Any, S : Any> GrammarContext.separated(
    term: Parser<T>,
    separator: Parser<S>,
    allowEmpty: Boolean = true,
    trailingSeparator: Boolean = false,
): Parser<List<T>> = term.separated(separator,allowEmpty, trailingSeparator)